<template>
  <div class="chart bar">
    <div class="chart-container" ref="barChart"></div>
  </div>
</template>

<script>
export default {
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const myChart = this.$echarts.init(this.$refs["barChart"]);
      const option = {
        title: {
          text: "Bar Chart",
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
          // data: ["Mon", "Tue", "Wed"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [120, 200, 150, 80, 70, 110, 130],
            // data: [120, 200, 150],
            type: "bar",
            // barWidth: 20,
            // barMaxWidth: 40,
            showBackground: true,
            backgroundStyle: {
              color: "rgba(180, 180, 180, 0.2)",
            },
          },
        ],
      };
      myChart.setOption(option);
    },
  },
};
</script>

<style></style>
